package src;

/**
 * @author zack
 * @create 2019-08-04-13:05
 */
public class Test8_1_1 {
    static void upcast(Cycle c) {
        System.out.println("转型成功");
    }

    public static void main(String[] args) {
        Unicycle unicycle = new Unicycle();
        Bicycle bicycle = new Bicycle();
        Tricycle tricycle = new Tricycle();
        upcast(unicycle);
        upcast(bicycle);
        upcast(tricycle);
    }
}

class Cycle {
    void print() {
        System.out.println("这是爸爸");
    }
}

class Unicycle extends Cycle {
    void print() {
        System.out.println("这是大儿子");
    }
}

class Bicycle extends Cycle {
    void print() {
        System.out.println("这是二儿子");
    }
}

class Tricycle extends Cycle {
    void print() {
        System.out.println("这是三儿子");
    }

}